<%@page import="com.wanmait.cookbook.vo.Works"%>
<%@page import="com.wanmait.cookbook.vo.Pager"%>
<%@page import="com.wanmait.cookbook.dao.CookbookDAO"%>
<%@page import="com.wanmait.cookbook.vo.Cookbook"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>	
<!-- saved from url=(0031)https://www.douguo.com/jingxuan -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!-- 热门推荐菜谱，从主页推荐菜谱更多进入 -->
<title>精选菜谱_菜谱大全_美食菜谱_家常菜谱做法_家常菜谱做法大全_豆果美食</title>
<link rel="icon"
	href="https://cp1.douguo.com/static/nweb/images/favicon.ico?v=1912"
	type="image/x-icon">
<link rel="stylesheet" href="<%=path%>/static/css/main.css">
<link rel="stylesheet" href="<%=path%>/static/css/sort.css">
<script src="<%=path%>/static/js/hm.js.下载"></script>
<script src="<%=path%>/static/js/jquery.js.下载"></script>
<script data-ad-client="ca-pub-6608973961595981" async=""
	src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
	var _hmt = _hmt || [];
	(function() {
		var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?f4fa5d56f272ae0a0777feec2184a97f";
		var s = document.getElementsByTagName("script")[0];
		s.parentNode.insertBefore(hm, s);
	})();
</script>
<style>
.one-pan-tip {
	cursor: pointer;
}

.one-pan-tip::before {
	background-position: center;
	background-size: 100% 100%;
	background-repeat: no-repeat;
	box-sizing: border-box;
	width: 1em;
	height: 1em;
	margin: 0 1px .15em 1px;
	vertical-align: middle;
	display: inline-block;
}

.one-pan-tip-success::before {
	content: '';
	background-image:
		url()
}

.one-pan-tip-error {
	text-decoration: line-through;
}

.one-pan-tip-error::before {
	content: '';
	background-image:
		url()
}

.one-pan-tip-other::before {
	content: '';
	background-image:
		url()
}

.one-pan-tip-lock::before {
	content: '';
	background-image:
		url()
}
</style>
<meta name="ljjc::status" content="on">
</head>
<body>
	<jsp:include page="/inc/head.jsp"></jsp:include>

	<div class="wrap">
		<div id="content">
			<div class="type-tab">
				<div class="type-head clearfix">
		<%-- <a href="<%=path %>/HotCookbookShowListServlet?action=getHotCookbookShowList" one-link-mark="yes">精选</a> --%>
		<a href="<%=path %>/HotCookbookShowListServlet?action=getOnePageCookbook"
			one-link-mark="yes">精选食谱</a> 
		<a href="<%=path %>/indexServlet?action=getAllRecipeType"
			one-link-mark="yes">食谱分类</a> 
		<a href="<%=path %>/indexServlet?action=getAllIngredientType"
			one-link-mark="yes">食材分类</a>
		<a href="<%=path%>/HotWorksServlet?action=allOnePagerWorksInc"
			one-link-mark="yes"  class="active">精选作品</a>	
		<hr width="1000">
	</div>
			</div>
			<h2 class="title">作品展示</h2>
			<ul id="jxlist" class="clearfix">
				<%
				List<Works> hotAllWorks= (List<Works>)request.getAttribute("hotAllWorks");
				List<Integer> worksCollectCounts =(List<Integer>)request.getAttribute("worksCollectCounts");
				for(int i=0;i<hotAllWorks.size();i++){
					if((i+1)%3!=0){
			%>
				<!-- 循环开始 -->
				<li class="item"><a class="cover" href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=hotAllWorks.get(i).getId() %>" target="_blank"
					style="position: relative" one-link-mark="yes"> <img
						src="<%=path %>/static/image/<%=hotAllWorks.get(i).getPic()%>">
				</a>
			
					<div class="relative">
						<a class="cookname text-lips" href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=hotAllWorks.get(i).getId() %>" target="_blank"
							one-link-mark="yes"> <%=hotAllWorks.get(i).getTitle() %>
							
						</a>	
						 <a class="author text-lips"
							style="max-width: 170px; vertical-align: middle;"
							href="<%=path %>/PersonalServlet?action=init&id=<%=hotAllWorks.get(i).getUserinfo().getId() %>"
							target="_blank" one-link-mark="yes"> <img
							src="<%=path%>/static/image/<%=hotAllWorks.get(i).getUserinfo().getAvatar()%>">
							<%=hotAllWorks.get(i).getUserinfo().getName() %>
						</a>

						<div class="view-coll">

							<span class="view">点赞<%=worksCollectCounts.get(i) %></span>
							<span><a href="javascriptt:void(0)"><img class="likeHeart" width="20" src="<%=path%>/img/kongxin.jpg"></a></span>

						</div>
					</div></li>
				<%}
					else{
					%>
				<li class="item" style="margin-right: 0px"><a class="cover"
					href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=hotAllWorks.get(i).getId() %>" target="_blank" style="position: relative"
					one-link-mark="yes"> <img
						src="<%=path %>/static/image/<%=hotAllWorks.get(i).getPic()%>">
				</a>
					<div class="relative">
						<a class="cookname text-lips" href="<%=path %>/HotWorksServlet?action=showWorks&worksId=<%=hotAllWorks.get(i).getId() %>" target="_blank"
							one-link-mark="yes"> <%=hotAllWorks.get(i).getTitle() %>
						</a> <a class="author text-lips"
							style="max-width: 170px; vertical-align: middle;"
							href="<%=path %>/PersonalServlet?action=init&id=<%=hotAllWorks.get(i).getUserinfo().getName() %>"
							target="_blank" one-link-mark="yes"> <img 
							src="<%=path%>/static/image/<%=hotAllWorks.get(i).getUserinfo().getAvatar()%>">
							<%=hotAllWorks.get(i).getUserinfo().getName() %>
						</a>

						<div class="view-coll">

							<span class="view">点赞<%=worksCollectCounts.get(i) %></span>
							<span><a href="javascriptt:void(0)"><img class="likeHeart" width="20" src="<%=path%>/img/kongxin.jpg"></a></span>

						</div>
					</div></li>
				<%
					}
				} 
				%>
				<!-- 循环结束 -->

				<!--显示小数字结束  -->
			</ul>
			<!-- 显示数字开始 -->
			<div id="cookbookPager" class="pages">
				<%
						Pager pager =(Pager)request.getAttribute("pager");
						int start=1;
						int end=pager.getPageCount();
						if(pager.getPageCount()>5){
							start=pager.getPageNo()-2<1?1:pager.getPageNo()-2;
							end=start+4;
							if(end>pager.getPageCount()){
								end=pager.getPageCount();
								start=end-4;
							}
						}
						%>
						<a href="javascript:void(0)" class="prevPager" one-link-mark="yes">上一页</a>
						<%
						for(int i=start;i<=end;i++){
						if(i==pager.getPageNo()){
							%><a href="javascript:void(0)" style="color:red" class="aliaon" one-link-mark="yes"><%=i %></a>
					<% 	}else{%>
						<a href="javascript:void(0)" class="aliaon" one-link-mark="yes"><%=i %></a>
						<% }	
						}%>
				<a href="javascript:void(0)" class="nextPager" one-link-mark="yes">下一页</a>
				<a href="javascript:void(0)" class="aliaon" one-link-mark="yes"><%=pager.getPageNo()%>/<%=pager.getPageCount() %></a>
				
<!-- 上下页事件开始 -->
<script type="text/javascript">
$(function(){
	//上一页点击事件
	$(".prevPager").click(function(){
		var n=<%=pager.getPageNo()%>;
		$.ajax({
			url:"<%=path%>/HotWorksServlet",
			data:{action:"allWorksInc",pageNo:n-1},
			success:function(mes){
				$("#content").html(mes);
			}
			
		});
	});
	//下一页点击事件
	$(".nextPager").click(function(){
		var n=<%=pager.getPageNo()%>;
		
		$.ajax({
			url:"<%=path%>/HotWorksServlet",
			data:{action:"allWorksInc",pageNo:n+1},
			success:function(mes){
				$("#content").html(mes);
			}
			
		});
	});

})
</script>	
<!--上下页事件结束  -->
			</div>

			<p class="fcc">
				你当前的位置：<a href="<%=path %>" title="豆果美食" one-link-mark="yes">豆果美食</a>
				&gt; <a href="<%=path%>/HotWorksServlet?action=allOnePagerWorksInc"
					title="作品" one-link-mark="yes">作品</a> &gt; 
			</p>
		</div>
	</div>
	<div id="footer">

		<jsp:include page="/inc/foot.jsp"></jsp:include>
	</div>
	<script src="<%=path%>/static/js/tip.js.下载"></script>
	<script src="<%=path%>/static/js/search.js.下载"></script>
	<script src="<%=path%>/static/js/main.js.下载"></script>
	<!-- <script src='https://s13.cnzz.com/c.php?id=30029854' language='JavaScript' charset='gb2312'></script> -->

</body>
</html>
<!--给数字添加点击事件  -->
<script type="text/javascript">
$(function(){
	$("#content").on("click",".aliaon",function(){
		$(".aliaon").css("color","black");//所有的数字变成黑色
		$(this).css("color","orange");
		var n=$(this).html();
		$.ajax({
			url:"<%=path%>/HotWorksServlet",
			data:{action:"allWorksInc",pageNo:n},
			success:function(mes){
				$("#content").html(mes);
			}
			
		});
	});
});

</script>
<script>
$(function(){
	$("#content").on("click",".likeHeart",function(){
		var likeSrc=$(this).attr("src");
		
		if("/cookbook/img/kongxin.jpg"==likeSrc){
			var likeSrc=$(this).attr("src","<%=path%>/img/shixin.jpg");
		}else{
			var likeSrc=$(this).attr("src","<%=path%>/img/kongxin.jpg");
		}
	});
});
</script>


